/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once

#include "../节点.h"
#include "向量.h"
#include "矩阵.h"



class C_Vec2插座 : public C_插座基类 {
public:
	C_Vec2插座(std::wstring name);
	~C_Vec2插座();

	vec2		m_Value;

	void*		f_getData(uint8 线程ID);
	void		f_setData(void* data, uint8 线程ID = -1);
	std::string	f_构建变量代码(int32 loc);
	bool		f_接入插座是否匹配(E_值类型 type);

	void		f_读取(FILE* f);
	void		f_写入(FILE* f);

	std::wstring		f_getTypeName() { return L"vec2"; }

	PyObject* f_bl_传入数据(PyObject* bl_data);
	PyObject* f_输出_bl数据(PyObject* bl_data = 0);
private:

};
#define DEF_转换为Vec2插座(socket) dynamic_cast<C_Vec2插座*>( (socket) )
#define DEF_Vec2插座数据(socket)  ( *(vec2*)(( (socket) )->f_getData(0)) )

#define DEF_创建Vec2插座_I(name)  socket = new C_Vec2插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建Vec2插座_O(name)  socket = new C_Vec2插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);






class C_Vec3插座 : public C_插座基类 {
public:
	C_Vec3插座(std::wstring name, vec3* mapVal = nullptr);
	~C_Vec3插座();

	S_Props     m_PropValue;
	vec3*		m_Value;

	void		f_update(C_插座基类* 连接到的输入节点, class C_节点基类* node);

	void*		f_getData(uint8 线程ID);
	void		f_setData(void* data, uint8 线程ID = 0);
	std::string	f_构建变量代码(int32 loc);
	bool		f_接入插座是否匹配(E_值类型 type);

	void		f_读取(FILE* f);
	void		f_写入(FILE* f);

	void        f_Copy(const C_插座基类* socket);

	std::wstring	f_getTypeName() { return L"vec3"; }
	PyObject*	f_bl_传入数据(PyObject* bl_data);
	PyObject*	f_输出_bl数据(PyObject* bl_data = 0);
private:

};
#define DEF_转换为Vec3插座(socket) dynamic_cast<C_Vec3插座*>( (socket) )
#define DEF_Vec3插座数据(socket)  ( *(vec3*)(( (socket) )->f_getData(0)) )

#define DEF_创建Vec3插座_v1_I(name)  socket = new C_Vec3插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建Vec3插座_I(name, mapVal)  socket = new C_Vec3插座( (name), (mapVal) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建Vec3插座_O(name)  socket = new C_Vec3插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);






class C_Vec4插座 : public C_插座基类 {
public:
	C_Vec4插座(std::wstring name);
	~C_Vec4插座();

	vec4		m_Value;

	void*		f_getData(uint8 线程ID);
	void		f_setData(void* data, int64 ID = -1);
	std::string	f_构建变量代码(int32 loc);
	bool		f_接入插座是否匹配(E_值类型 type);


	void		f_读取(FILE* f);
	void		f_写入(FILE* f);

	std::wstring		f_getTypeName() { return L"vec4"; }
	PyObject*	f_bl_传入数据(PyObject* bl_data);
private:

};
#define DEF_转换为Vec4插座(socket) dynamic_cast<C_Vec4插座*>( (socket) )
#define DEF_Vec4插座数据(socket)  ( (vec4*)((socket)->f_getData(0)) )

#define DEF_创建Vec4插座_I(name)  socket = new C_Vec4插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建Vec4插座_O(name)  socket = new C_Vec4插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);







class C_iVec2插座 : public C_插座基类 {
	ivec2		m_默认值;
public:
	C_iVec2插座(std::wstring name, ivec2* m = nullptr);
	~C_iVec2插座();

	ivec2*		m_Value;

	void*		f_getData(uint8 线程ID);
	void		f_setData(void* data, int64 ID = -1);
	std::string	f_构建变量代码(int32 loc);
	bool		f_接入插座是否匹配(E_值类型 type);

	void		f_读取(FILE* f);
	void		f_写入(FILE* f);

	std::wstring		f_getTypeName() { return L"ivec2"; }
	
};

#define DEF_iVec2插座(socket) dynamic_cast<C_iVec2插座*>( (socket) )
#define DEF_iVec2插座数据(socket)  ( *(ivec2*) ((socket)->f_getData(0)) )

#define DEF_创建iVec2插座_I(name)  socket = new C_iVec2插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建iVec2插座_O(name)  socket = new C_iVec2插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);
#define DEF_创建iVec2插座_Ip(name, mv)  socket = new C_iVec2插座( (name), (mv) ); f_add插座(socket, E_插座方向::e_插座Type_输入);


class C_uVec2插座 : public C_插座基类 {
public:
	C_uVec2插座(std::wstring name);
	~C_uVec2插座();

	uvec2		m_Value;

	void*		f_getData(uint8 线程ID);
	void		f_setData(void* data, uint8 线程ID);
	std::string	f_构建变量代码(int32 loc);

	void		f_读取(FILE* f);
	void		f_写入(FILE* f);

	std::wstring		f_getTypeName() { return L"uvec2"; }
};
#define DEF_uVec2插座(socket) dynamic_cast<C_uVec2插座*>( (socket) )
#define DEF_uVec2插座数据(socket)  ( *( (uvec2*) (socket)->f_getData(0) ) )

#define DEF_创建uVec2插座_I(name)  socket = new C_uVec2插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建uVec2插座_O(name)  socket = new C_uVec2插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);






class C_iVec3插座 : public C_插座基类 {
	ivec3 m_默认值;
	ivec3 m_转换值;
public:
	C_iVec3插座(std::wstring name);
	~C_iVec3插座();

	ivec3*		m_Value;

	void*		f_getData(uint8 线程ID);
	void		f_setData(void* data, int64 ID = -1);

	std::string	f_构建变量代码(int32 loc);
	bool		f_接入插座是否匹配(E_值类型 type);

	void		f_读取(FILE* f);
	void		f_写入(FILE* f);

	std::wstring		f_getTypeName() { return L"ivec3"; }
};
#define DEF_转换为iVec3插座(socket) dynamic_cast<C_iVec3插座*>( (socket) )
#define DEF_iVec3插座数据(socket)  ( *(ivec3*) ((socket)->f_getData(0)) )

#define DEF_创建iVec3插座_I(name)  socket = new C_iVec3插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建iVec3插座_O(name)  socket = new C_iVec3插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);






class C_uVec3插座 : public C_插座基类 {
public:
	C_uVec3插座(std::wstring name);
	//~C_uVec3插座();
	uvec3		m_Value;

	void*		f_getData(uint8 插座 = 0);
	void		f_setData(void* data, uint8 线程ID = 0);
	std::string	f_构建变量代码(int32 loc);
	//bool		f_接入插座是否匹配(E_值类型 type);

	void		f_读取(FILE* f);
	void		f_写入(FILE* f);

	std::wstring		f_getTypeName() { return L"uvec3"; }

};
#define DEF_转换为uVec3插座(socket) dynamic_cast<C_uVec3插座*>( (socket) )
#define DEF_uVec3插座数据(socket)  ( (uvec3*) (DEF_转换为uVec3插座(socket)->f_getData()) )

#define DEF_创建uVec3插座_I(name)  socket = new C_uVec3插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建uVec3插座_O(name)  socket = new C_uVec3插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);








class C_uVec4插座 : public C_插座基类 {
public:
	C_uVec4插座(std::wstring name);
	~C_uVec4插座();

	uvec4		m_Value;

	void*		f_getData();
	void		f_setData(void* data, int64 ID = -1);

	void		f_读取(FILE* f);
	void		f_写入(FILE* f);

	std::wstring		f_getTypeName() { return L"uvec4"; }
	PyObject*	f_bl_传入数据(PyObject* bl_data);
};
#define DEF_转换为uVec4插座(socket) dynamic_cast<C_uVec4插座*>( (socket) )
#define DEF_uVec4插座Value(socket)  ( *(uvec4*) (DEF_转换为uVec4插座(socket)->f_getData()) )

#define DEF_uVec4插座创建_I(name)  socket = new C_uVec4插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_uVec4插座创建_O(name)  socket = new C_uVec4插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);









class C_Mat3X3插座 : public C_插座基类 {
public:
	C_Mat3X3插座(std::wstring name);
	~C_Mat3X3插座();

	mat3X3	m_Value;

	void*		f_getData(uint8 线程ID);
	void		f_setData(void* data, int64 ID = -1);

	void		f_读取(FILE* f);
	void		f_写入(FILE* f);

	std::wstring		f_getTypeName() { return L"m3x3"; }
	PyObject*	f_输出_bl数据(PyObject* bl_data = 0);
};
#define DEF_Mat3X3插座(socket) dynamic_cast<C_Mat3X3插座*>( (socket) )
#define DEF_Mat3X3插座数据(socket)  ( (mat3X3*) ((socket)->f_getData(0)) )

#define DEF_创建mat3X3插座_I(name)  socket = new C_Mat3X3插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建mat3X3插座_O(name)  socket = new C_Mat3X3插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);







class C_Matrix4X4插座 : public C_插座基类 {

public:
	C_Matrix4X4插座(std::wstring name);
	~C_Matrix4X4插座();

	Mat44f		m_Value;

	void*		f_getData(uint8 线程ID);
	void		f_setData(void* data, int64 ID = -1);

	void		f_读取(FILE* f);
	void		f_写入(FILE* f);
	std::string		f_构建变量代码(int32 loc);
	bool			f_接入插座是否匹配(E_值类型 type);

	std::wstring		f_getTypeName() { return L"m4x4"; }
private:

};
#define DEF_Mat4X4插座(socket) dynamic_cast<C_Matrix4X4插座*>( (socket) )
#define DEF_Mat4X4插座数据(socket)  ( ((Mat44f*) (DEF_Mat4X4插座(socket)->f_getData(0)) ) )

#define DEF_创建Mat4X4插座_I(name)  socket = new C_Matrix4X4插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建Mat4X4插座_O(name)  socket = new C_Matrix4X4插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);



PyObject * f_构建Mat4X4_Py数据(const C_Mat44& mats, C_Mat44* 转换坐标系, PyObject* bl_data=0);







class C_Quat插座 : public C_插座基类 {
public:
	C_Quat插座(std::wstring name);
	~C_Quat插座();

	Quat		m_Value;

	void*		f_getData(uint8 线程ID);
	void		f_setData(void* data, int64 ID = -1);

	void		f_读取(FILE* f);
	void		f_写入(FILE* f);

	std::wstring		f_getTypeName() { return L"quat"; }
private:

};
#define DEF_Quat插座(socket) dynamic_cast<C_Quat插座*>( (socket) )
#define DEF_Quat插座数据(socket)  ((Quat*)((socket)->f_getData(0)))

#define DEF_创建Quat插座_I(name)  socket = new C_Quat插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建Quat插座_O(name)  socket = new C_Quat插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);








class C_线段插座 : public C_插座基类 {
public:
	C_线段插座(std::wstring name);
	~C_线段插座();

	S_线段	m_Value;

	void*	f_getData(uint8 线程ID);
	void	f_setData(void* data, int64 ID = -1);

	void	f_读取(FILE* f);
	void	f_写入(FILE* f);

	std::wstring		f_getTypeName() { return L"Line"; }
private:

};
#define DEF_线段插座(socket) dynamic_cast<C_线段插座*>( (socket) )
#define DEF_线段插座数据(socket, loc)  ((S_线段*)((socket)->f_getData(loc)))

#define DEF_创建线段插座_I(name)  socket = new C_线段插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建线段插座_O(name)  socket = new C_线段插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);









